public class Label extends Quaternion {
    private String label;       //begin end
    private Pairs pairs;        //func
    private String type;        //global  func  main  cond  if else while   block
    private int index;
    private String returnType;  //int void
    private int cond_index = 0;

    public Label(String label, int index, String type) {
        super(OP.LABEL);
        this.type = type;
        this.label = label;
        this.index = index;
    }

    public Label(Pairs pairs, String label, String type) {
        super(OP.LABEL);
        this.pairs = pairs;
        this.label = label;
        this.type = type;
    }

    public String getLabel() {
        return this.label;
    }

    public Pairs getPairs() {
        return pairs;
    }

    public void setCond_index(int num) {
        this.cond_index = num;
    }

    public String toString() {
        if (pairs == null) {
            if (cond_index > 0) {
                return opToString() + "_" + type + "_" + label + "_" + index + "_" + cond_index + ":" + "\n";
            }
            return opToString() + "_" + type + "_" + label + "_" + index + ":" + "\n";
        }
        return opToString() + "_" + type + "_" + pairs.getToken() + "_" + label + ":" + "\n";
    }

    public String labelName() {
        return pairs.getToken() + label;
    }

    public String branchName() {
        if (cond_index > 0) {
            return  type + "_" + label + "_" + index + "_" + cond_index;
        }
        return this.type + "_" + this.label + "_" + index;
    }

    public String getType() {
        return type;
    }
}
